
import Vue from "vue"
import VueRouter from "vue-router"
Vue.use(VueRouter)

const mode = "history"

const routes = [
	{
		path: "/",
		component: resolve => require(['../views/home.vue'], resolve),
	},
	
	{
		path: "/main/playList",
		component: resolve => require(['../views/playList.vue'], resolve),
	},
	
	{
		path: "/main",
		component: resolve => require(['../views/main.vue'], resolve),
		children:[
			// {
			// 	path: "/main/album",
			// 	component: resolve => require(['../views/album.vue'], resolve),
			// },
		
			
		
			{
				path: "/main/play",
				component: resolve => require(['../views/play.vue'], resolve),
			},
			{
				path: "/main/index",
				component: resolve => require(['../views/index.vue'], resolve),
			},
		]
	},

	
]

export default new VueRouter({
	mode,
	routes,
	scrollBehavior(to, from, savedPosition) {
		if (savedPosition) {
			return savedPosition
		}

		if (to.hash) {
			return {
				selector: to.hash
			}
		}
		
		return {
			y: 0
		}
	}
})